package com.blockchainenergy;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import sun.misc.Unsafe;

import java.lang.reflect.Field;

@EnableScheduling
@SpringBootApplication
@ServletComponentScan //启动器启动时，扫描本目录以及子目录带有的webservlet注解的
@MapperScan({"com.blockchainenergy.*.*.dao"})
public class BlockchainenergyApplication {
    public static void disableWarning() {
        try {
            Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
            theUnsafe.setAccessible(true);
            Unsafe u = (Unsafe) theUnsafe.get(null);

            Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
            Field logger = cls.getDeclaredField("logger");
            u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
        } catch (Exception e) {
            // ignore
        }
    }

    public static void main(String[] args) {
        disableWarning(); //禁用警告
        SpringApplication.run(BlockchainenergyApplication.class, args);
    }
}
